use async_graphql::{Context, Enum, ID};
use derivative::Derivative;
use serde::{Deserialize, Serialize};
use serde_json::Result;

#[derive(async_graphql::InputObject, Serialize, Deserialize, Clone, Debug)]
/// Integer filter including: INT, INTEGER, TINYINT, SMALLINT, MEDIUMINT, BIGINT, UNSIGNED, BIGINT,INT2,INT8
pub struct IntFilterIn {
    pub eq: Option<i64>,
    pub inl: Option<Vec<i64>>,
    pub le: Option<i64>,
    pub lt: Option<i64>,
    pub ge: Option<i64>,
    pub gt: Option<i64>,
    pub between: Option<IntRangeIn>,
}

#[derive(async_graphql::InputObject, Serialize, Deserialize, Clone, Debug)]
/// floating number filter including: REAL, DOUBLE, DOUBLE PRECISION, FLOAT
pub struct RealFilterIn {
    pub eq: Option<f64>,
    pub inl: Option<Vec<f64>>,
    pub le: Option<f64>,
    pub lt: Option<f64>,
    pub ge: Option<f64>,
    pub gt: Option<f64>,
    pub between: Option<RealRangeIn>,
}

#[derive(async_graphql::InputObject, Serialize, Deserialize, Clone, Debug)]
pub struct DateFilterIn {
    pub eq: Option<i64>,
    pub inl: Option<Vec<i64>>,
    pub le: Option<i64>,
    pub lt: Option<i64>,
    pub ge: Option<i64>,
    pub gt: Option<i64>,
    pub between: Option<DateRangeIn>,
}

#[derive(async_graphql::InputObject, Serialize, Deserialize, Clone, Debug)]
pub struct DateTimeFilterIn {
    pub eq: Option<i64>,
    pub inl: Option<Vec<i64>>,
    pub le: Option<i64>,
    pub lt: Option<i64>,
    pub ge: Option<i64>,
    pub gt: Option<i64>,
    pub between: Option<DateTimeRangeIn>,
}

#[derive(async_graphql::InputObject, Serialize, Deserialize, Clone, Debug)]
pub struct StringExactFilterIn {
    pub eq: Option<String>,
    pub inl: Option<Vec<String>>,
    pub le: Option<String>,
    pub lt: Option<String>,
    pub ge: Option<String>,
    pub gt: Option<String>,
    pub between: Option<StringRangeIn>,
}


#[derive(async_graphql::InputObject, Serialize, Deserialize, Clone, Debug)]
pub struct StringPatternFilterIn {
    /// string LIKE pattern [ESCAPE escape-character], The LIKE expression returns true if the string matches the supplied pattern.
    pub like: Option<String>,
    /// string NOT LIKE pattern [ESCAPE escape-character], the NOT LIKE expression returns false if LIKE returns true, and vice versa. An equivalent expression is NOT (string LIKE pattern).
    pub nlike: Option<Vec<String>>,
    /// string SIMILAR TO pattern [ESCAPE escape-character]
    pub similar: Option<String>,
    /// string NOT SIMILAR TO pattern [ESCAPE escape-character]
    pub nsimilar: Option<String>,

    /// Matches regular expression, case sensitive
    pub regexp: Option<String>,

    /// Matches regular expression, case insensitive
    pub regexpi: Option<String>,
}

#[derive(async_graphql::InputObject, Serialize, Deserialize, Clone, Debug)]
pub struct IntRangeIn {
    pub min: i64,
    pub max: i64,
}

#[derive(async_graphql::InputObject, Serialize, Deserialize, Clone, Debug)]
pub struct RealRangeIn {
    pub min: f64,
    pub max: f64,
}

#[derive(async_graphql::InputObject, Serialize, Deserialize, Clone, Debug)]
pub struct DateRangeIn {
    pub min: i64,
    pub max: i64,
}

#[derive(async_graphql::InputObject, Serialize, Deserialize, Clone, Debug)]
pub struct DateTimeRangeIn {
    pub min: i64,
    pub max: i64,
}

#[derive(async_graphql::InputObject, Serialize, Deserialize, Clone, Debug)]
pub struct StringRangeIn {
    pub min: String,
    pub max: String,
}


